import axios from '../utils/request';
import Secret  from './mysign';
import base from './base';
//md5加密
import md5 from 'js-md5';

//定义操作的方法
const api = {
    /**
     * 获取病毒信息
     */
    getCovidInfo() {
        return axios.get(base.covidInfo)
    },
    /**
     * 获取地图数据-- 
     */
    chinaMap() {
        return axios.get(base.baseUrl+base.chinaMap + Secret.sign)
    },
    /**
     * 疫情地图-城市数据获取 city_name
     */
    cityData(params) {
        //format=json&appid=6938&sign=687569b1fd450f3491cd6e72f82aacf7
        //md5处理数据： sign = MD5(appid1city_name武汉formatjsontime1545829466密钥)
        let info=md5('appid6938city_name'+params.city+'formatjson709b25c001c8d3325061a5baf7bb7615');
        // console.log(info);
        let citySign='?format=json&appid=6938&city_name='+params.city+'&sign='+info
        return axios.get(base.baseUrl+base.cityData + citySign)

    },
    /**
     * 疫情地图-国外
     */
    GuowaiData(){
        return axios.get(base.baseUrl+base.guowai+Secret.sign)
    },
    /**
     * 疫情曲线图 
     * 
     */
     covidSwiper(){
        return axios.get(base.covidSwiper)
     },
     /**
      * 城市出行
      */
      TravelCitys(params){
          return axios.get(base.TravelCitys,{
              params
          })
      },
      /**
       * 城市防疫 key=&from=10191&to=10349
       */
       TravelCitysInfo(params){
            return axios.get(base.TravelCitysInfo,{
                params
            })
       }
     



}

export default api